package com.study.d6_exception;

import java.util.Scanner;

public class ExcepHandle2 {
    public static void main(String[] args) {
        while (true) {
            try {
                double price = getPrice();
                System.out.println("商品定价是"+price);
                break;
            } catch (Exception e) {
                System.out.println("别瞎搞");
            }
        }
    }

    private static double getPrice() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入合理价格");
        double inp = sc.nextDouble();
        return inp;
    }
}
